package com.ybear.ybutils.utils.handler;

import android.os.Message;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public interface Handler {
    android.os.Handler getOsHandler();
    Handler getHandler();

    void setCallback(Callback call);

    boolean post(Runnable r);
    boolean post(Runnable r, long delayMillis);
    boolean postDelayed(Runnable r, long delayMillis);

    boolean sendMessage(@NonNull Message msg);
    boolean sendEmptyMessage(int what);
    boolean sendEmptyMessageDelayed(int what, long delayMillis);
    boolean sendEmptyMessageAtTime(int what, long uptimeMillis);
    boolean sendMessageDelayed(@NonNull Message msg, long delayMillis);
    boolean sendMessageAtTime(@NonNull Message msg, long uptimeMillis);
    boolean sendMessageAtFrontOfQueue(@NonNull Message msg);

    void removeMessages(int what);
    void removeMessages(int what, @Nullable Object object);
    void removeCallbacksAndMessages(@Nullable Object token);

    void addOnErrorListener(HandlerManage.OnErrorListener l);
    void removeErrorListener(HandlerManage.OnErrorListener l);

    void addHandleMessageListener(HandlerManage.OnHandleMessageListener l);
    void removeOnHandleMessageListener(HandlerManage.OnHandleMessageListener l);
}
